x86: Only unshadow on failed emulation, not when an exception is raised.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 21 Feb 2007 20:30:37 +0000 (20:30 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 21 Feb 2007 20:30:37 +0000 (20:30 +0000)
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/mm/shadow/multi.c

index e73fdeecd41ee4b35f3ee3173d7c049dc55c6a66..cce70bc522c885eb496c5dc0927052a1f8ead0c5 100644 (file)
@@ -2915,7 +2915,12 @@ static int sh_page_fault(struct vcpu *v,
     if ( !(regs->error_code & PFEC_user_mode) )
         r = x86_emulate(&emul_ctxt.ctxt, emul_ops);
 
-    if ( (r == X86EMUL_UNHANDLEABLE) || (r == X86EMUL_EXCEPTION) )
+    /*
+     * NB. We do not unshadow on X86EMUL_EXCEPTION. It's not clear that it
+     * would be a good unshadow hint. If we *do* decide to unshadow-on-fault
+     * then it must be 'failable': we cannot require the unshadow to succeed.
+     */
+    if ( r == X86EMUL_UNHANDLEABLE )
     {
         SHADOW_PRINTK("emulator failure, unshadowing mfn %#lx\n", 
                        mfn_x(gmfn));